package com.example.demo;

import com.example.demo.demos.service.impl.LocalSyncService;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@EnableScheduling
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
    @Bean
    public CommandLineRunner delayedSync(LocalSyncService localSyncService) {
        return args -> {
            // 应用启动30秒后执行首次同步
            Thread.sleep(30000);
            localSyncService.syncAllTables();
        };
    }
}

